@model AdminMenuListViewModel

<style asp-src="~/OrchardCore.AdminMenu/Styles/admin-menu.min.css" debug-src="~/OrchardCore.AdminMenu/Styles/admin-menu.css" at="Head" depends-on="admin"></style>
<script asp-src="~/OrchardCore.AdminMenu/Scripts/admin-menu.min.js" debug-src="~/OrchardCore.AdminMenu/Scripts/admin-menu.js" at="Foot" depends-on="admin"></script>

<div class="row">
    <div class="form-group col mb-n1">
        <h1>@RenderTitleSegments(T["Admin Menus"])</h1>
    </div>
    <div class="form-group col mb-n1">
        <div class="dropdown float-right order-md-1">
            <a asp-route-action="Create" class="btn btn-primary float-right" role="button">@T["Add Admin Menu"]</a>
        </div>
    </div>
</div>

<form asp-action="List" method="get">
    <div class="card mb-3">
        <div class="card-body bg-light p-3">
            <div class="input-group input-group-sm w-lg-50">
                <div class="input-group-prepend">
                    <span class="input-group-text bg-secondary text-light">@T["Filter"]</span>
                </div>
                <input id="search-box" asp-for="Options.Search" class="form-control" placeholder="@T["Search"]" type="search" autofocus />
                <div class="input-group-append">
                    <button type="submit" class="btn btn-sm btn-secondary">@T["Search"]</button>
                </div>
            </div>
        </div>
    </div>
</form>

<form asp-action="Index">
    @* the form is necessary to generate an antiforgery token for the delete and toggle actions *@

    @if (Model.AdminMenu.Any())
    {
        <ul id="content-items-list-body" class="list-group">
            @foreach (var entry in Model.AdminMenu)
            {
                <li class="list-group-item @(entry.AdminMenu.Enabled ? "" : "disabled-tree")">
                    <div class="related">
                        <a asp-controller="Node" asp-action="List" asp-route-id="@entry.AdminMenu.Id" class="btn btn-secondary btn-sm">@T["Edit Nodes"]</a>
                        <a asp-action="Edit" asp-route-id="@entry.AdminMenu.Id" class="btn btn-primary btn-sm">@T["Edit"]</a>
                        <div class="btn-group btn-group-sm">
                            <a asp-action="Delete"
                               asp-route-id="@entry.AdminMenu.Id"
                               class="btn btn-danger" itemprop="RemoveUrl UnsafeUrl">@T["Delete"]</a>
                            <button type="button" class="btn btn-danger dropdown-toggle dropdown-toggle-split" data-reference="parent" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                <span class="sr-only">@T["Toggle Dropdown"]</span>
                            </button>
                            <div class="dropdown-menu">
                                <a asp-action="Toggle"
                                   asp-route-id="@entry.AdminMenu.Id"
                                   class="dropdown-item btn-sm" itemprop="UnsafeUrl">@(entry.AdminMenu.Enabled ? T["Disable"] : T["Enable"])</a>
                            </div>
                        </div>
                    </div>
                    <a asp-controller="Node" asp-action="List" asp-route-id="@entry.AdminMenu.Id" class="tree-name-link">@entry.AdminMenu.Name</a>
                </li>
            }
        </ul>
    }
    else
    {
        <div class="no-results alert alert-info" role="alert">
            @T["<strong>Nothing here!</strong> Your search returned no results."]
        </div>
    }
</form>

<div id="footer-pager" class="fade-in-pager">
    @await DisplayAsync(Model.Pager)
</div>
